\doxysection{dji\+\_\+motor.\+h}
\hypertarget{dji__motor_8h_source}{}\label{dji__motor_8h_source}\index{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/modules/motor/DJImotor/dji\_motor.h@{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/modules/motor/DJImotor/dji\_motor.h}}
\mbox{\hyperlink{dji__motor_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#ifndef\ DJI\_MOTOR\_H}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#define\ DJI\_MOTOR\_H}}
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#include\ "{}bsp\_can.h"{}}}
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{controller_8h}{controller.h}}"{}}}
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{motor__def_8h}{motor\_def.h}}"{}}}
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#include\ "{}stdint.h"{}}}
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#include\ "{}daemon.h"{}}}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ \textcolor{preprocessor}{\#define\ DJI\_MOTOR\_CNT\ 12}}
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00026\ \textcolor{comment}{/*\ 滤波系数设置为1的时候即关闭滤波\ */}}
\DoxyCodeLine{00027\ \textcolor{preprocessor}{\#define\ SPEED\_SMOOTH\_COEF\ 0.85f\ \ \ \ \ \ }\textcolor{comment}{//\ 最好大于0.85}}
\DoxyCodeLine{00028\ \textcolor{preprocessor}{\#define\ CURRENT\_SMOOTH\_COEF\ 0.9f\ \ \ \ \ }\textcolor{comment}{//\ 必须大于0.9}}
\DoxyCodeLine{00029\ \textcolor{preprocessor}{\#define\ ECD\_ANGLE\_COEF\_DJI\ 0.043945f\ }\textcolor{comment}{//\ (360/8192),将编码器值转化为角度制}}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ \textcolor{comment}{/*\ DJI电机CAN反馈信息*/}}
\DoxyCodeLine{00032\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{00033\ \{}
\DoxyCodeLine{00034\ \ \ \ \ uint16\_t\ last\_ecd;\ \ \ \ \ \ \ \ \textcolor{comment}{//\ 上一次读取的编码器值}}
\DoxyCodeLine{00035\ \ \ \ \ uint16\_t\ ecd;\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 0-\/8191,刻度总共有8192格}}
\DoxyCodeLine{00036\ \ \ \ \ \textcolor{keywordtype}{float}\ angle\_single\_round;\ \textcolor{comment}{//\ 单圈角度}}
\DoxyCodeLine{00037\ \ \ \ \ \textcolor{keywordtype}{float}\ speed\_aps;\ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 角速度,单位为:度/秒}}
\DoxyCodeLine{00038\ \ \ \ \ int16\_t\ real\_current;\ \ \ \ \ \textcolor{comment}{//\ 实际电流}}
\DoxyCodeLine{00039\ \ \ \ \ uint8\_t\ temperature;\ \ \ \ \ \ \textcolor{comment}{//\ 温度\ Celsius}}
\DoxyCodeLine{00040\ }
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keywordtype}{float}\ total\_angle;\ \ \ \textcolor{comment}{//\ 总角度,注意方向}}
\DoxyCodeLine{00042\ \ \ \ \ int32\_t\ total\_round;\ \textcolor{comment}{//\ 总圈数,注意方向}}
\DoxyCodeLine{00043\ \}\ \mbox{\hyperlink{struct_d_j_i___motor___measure__s}{DJI\_Motor\_Measure\_s}};}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00049\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{00050\ \{}
\DoxyCodeLine{00051\ \ \ \ \ \mbox{\hyperlink{struct_d_j_i___motor___measure__s}{DJI\_Motor\_Measure\_s}}\ measure;\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 电机测量值}}
\DoxyCodeLine{00052\ \ \ \ \ \mbox{\hyperlink{struct_motor___control___setting__s}{Motor\_Control\_Setting\_s}}\ motor\_settings;\ \textcolor{comment}{//\ 电机设置}}
\DoxyCodeLine{00053\ \ \ \ \ \mbox{\hyperlink{struct_motor___controller__s}{Motor\_Controller\_s}}\ motor\_controller;\ \ \ \ \textcolor{comment}{//\ 电机控制器}}
\DoxyCodeLine{00054\ }
\DoxyCodeLine{00055\ \ \ \ \ CANInstance\ *motor\_can\_instance;\ \textcolor{comment}{//\ 电机CAN实例}}
\DoxyCodeLine{00056\ \ \ \ \ \textcolor{comment}{//\ 分组发送设置}}
\DoxyCodeLine{00057\ \ \ \ \ uint8\_t\ sender\_group;}
\DoxyCodeLine{00058\ \ \ \ \ uint8\_t\ message\_num;}
\DoxyCodeLine{00059\ }
\DoxyCodeLine{00060\ \ \ \ \ Motor\_Type\_e\ motor\_type;\ \ \ \ \ \ \ \ \textcolor{comment}{//\ 电机类型}}
\DoxyCodeLine{00061\ \ \ \ \ Motor\_Working\_Type\_e\ stop\_flag;\ \textcolor{comment}{//\ 启停标志}}
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00063\ \ \ \ \ DaemonInstance*\ daemon;}
\DoxyCodeLine{00064\ \ \ \ \ uint32\_t\ feed\_cnt;}
\DoxyCodeLine{00065\ \ \ \ \ \textcolor{keywordtype}{float}\ dt;}
\DoxyCodeLine{00066\ \}\ \mbox{\hyperlink{struct_d_j_i_motor_instance}{DJIMotorInstance}};}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00084\ \mbox{\hyperlink{struct_d_j_i_motor_instance}{DJIMotorInstance}}\ *\mbox{\hyperlink{dji__motor_8h_ae6a2dbd0d46fc7d80c6e2339aad09969}{DJIMotorInit}}(\mbox{\hyperlink{struct_motor___init___config__s}{Motor\_Init\_Config\_s}}\ *config);}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00093\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{dji__motor_8h_afc682af85b4e84a7a74d01097cf738e5}{DJIMotorSetRef}}(\mbox{\hyperlink{struct_d_j_i_motor_instance}{DJIMotorInstance}}\ *motor,\ \textcolor{keywordtype}{float}\ ref);}
\DoxyCodeLine{00094\ }
\DoxyCodeLine{00102\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{dji__motor_8h_af949d3574538d826035110bf7e05c2f8}{DJIMotorChangeFeed}}(\mbox{\hyperlink{struct_d_j_i_motor_instance}{DJIMotorInstance}}\ *motor,\ \mbox{\hyperlink{motor__def_8h_a306d656c63a2d986e7aff57a0526395d}{Closeloop\_Type\_e}}\ loop,\ Feedback\_Source\_e\ type);}
\DoxyCodeLine{00103\ }
\DoxyCodeLine{00107\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{dji__motor_8h_a550e8d4dd6e722e66552563550191c65}{DJIMotorControl}}();}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00113\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{dji__motor_8h_a51d98dd3aee5e6e9530db1eb31f43642}{DJIMotorStop}}(\mbox{\hyperlink{struct_d_j_i_motor_instance}{DJIMotorInstance}}\ *motor);}
\DoxyCodeLine{00114\ }
\DoxyCodeLine{00120\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{dji__motor_8h_a7488031c4d093a41e2eaf8dd3881365b}{DJIMotorEnable}}(\mbox{\hyperlink{struct_d_j_i_motor_instance}{DJIMotorInstance}}\ *motor);}
\DoxyCodeLine{00121\ }
\DoxyCodeLine{00128\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{dji__motor_8h_adbffe8a35fe1da0ed6c36227ce30f1cd}{DJIMotorOuterLoop}}(\mbox{\hyperlink{struct_d_j_i_motor_instance}{DJIMotorInstance}}\ *motor,\ \mbox{\hyperlink{motor__def_8h_a306d656c63a2d986e7aff57a0526395d}{Closeloop\_Type\_e}}\ outer\_loop);}
\DoxyCodeLine{00129\ }
\DoxyCodeLine{00130\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ !DJI\_MOTOR\_H}}

\end{DoxyCode}
